
package com.sttk.fastMark.camera.adapter;


import android.widget.ImageView;

import androidx.annotation.NonNull;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.sttk.fastMark.camera.R;
import com.sttk.fastMark.camera.basic.ProviderMultiAdapter;
import com.sttk.fastMark.camera.basic.picselect.SelectMediaEntity;

public class SelPictureAdapter extends ProviderMultiAdapter<SelectMediaEntity> {


    public SelPictureAdapter() {
        addItemProvider(new SelPictureProvider());
    }

    private class SelPictureProvider extends BaseItemProvider<SelectMediaEntity> {
        @Override
        public int getItemViewType() {
            return ProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_sel_picture;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, SelectMediaEntity selectMediaEntity) {
            Glide.with(getContext()).load(selectMediaEntity.getPath())
                    .into((ImageView) baseViewHolder.getView(R.id.ivSelPictureItemImg));
            if (selectMediaEntity.isChecked()) {
                baseViewHolder.setImageResource(R.id.ivSelPictureItemSel, R.drawable.xz);
            } else {
                baseViewHolder.setImageResource(R.id.ivSelPictureItemSel, R.drawable.wxz);
            }
        }
    }

}
